<!--
 * 档案附件 表单组件
 * :
 * @version: 1.0
 * @author: lakeside hubin_yuan.410@hotmail.com
 * @date: 20120-07-14
 * @LastEditors:
 * @LastEditTime:
 -->
<template>
  <el-form ref="attachedForm" :disabled="!form.editable" :model="form.entry" :rules="form.editable?rules:{}"
           label-position="right"
           label-width="6rem">
    <el-row>
      <el-col :lg="12" :md="24">
        <el-form-item label="门类主键" prop="categoryId">
          <el-input v-model="form.entry.categoryId" :disabled="!form.editable" :readonly="!form.editable"
                    autocomplete="off" placeholder=""></el-input>
        </el-form-item>
      </el-col>
      <el-col :lg="12" :md="24">
        <el-form-item label="文件原文" prop="originalId">
          <el-input v-model="form.entry.originalId" :disabled="!form.editable" :readonly="!form.editable"
                    autocomplete="off" placeholder=""></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :lg="12" :md="24">
        <el-form-item label="档案卷宗主键" prop="dossierId">
          <el-input v-model="form.entry.dossierId" :disabled="!form.editable" :readonly="!form.editable"
                    autocomplete="off" placeholder=""></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row v-if="false">
      <el-col :lg="12" :md="24">
        <el-form-item label="创建者" prop="createdByName">
          <el-input v-model="form.entry.createdByName" :disabled="!form.editable" :readonly="!form.editable"
                    autocomplete="off" placeholder=""></el-input>
        </el-form-item>
      </el-col>
      <el-col :lg="12" :md="24">
        <el-form-item label="创建时间" prop="createdDate">
          <el-date-picker v-model="form.entry.createdDate" :disabled="!form.editable" :readonly="!form.editable" align="l"
                          format="yyyy-MM-dd HH:mm:ss"
                          placeholder="" type="datetime"
                          value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
        </el-form-item>
      </el-col>
      <el-col :lg="12" :md="24">
        <el-form-item label="最后修改者" prop="modifiedByName">
          <el-input v-model="form.entry.modifiedByName" :disabled="!form.editable" :readonly="!form.editable" autocomplete="off"
                    placeholder=""></el-input>
        </el-form-item>
      </el-col>
      <el-col :lg="12" :md="24">
        <el-form-item label="最后修改时间" prop="modifiedDate">
          <el-date-picker v-model="form.entry.modifiedDate" :disabled="!form.editable" :readonly="!form.editable" align="l"
                          format="yyyy-MM-dd HH:mm:ss"
                          placeholder="" type="datetime"
                          value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :lg="24" :md="24">
        <el-form-item label="备注描述" prop="remarkNote">
          <el-input v-model="form.entry.remarkNote" :autosize="{minRows: 2}" :disabled="!form.editable" :readonly="!form.editable"
                    autocomplete="off"
                    placeholder="" type="textarea">
          </el-input>
        </el-form-item>
      </el-col>
      <el-col :lg="12" :md="24">
        <el-form-item label="排序" prop="sortNum">
          <el-input-number v-model="form.entry.sortNum" :disabled="!form.editable" :readonly="!form.editable" autocomplete="off"
                           placeholder=""></el-input-number>
        </el-form-item>
      </el-col>
      <el-col :lg="12" :md="24">
        <el-form-item label="有效状态" prop="validStatus">
          <dict-option-select v-model="form.entry.validStatus" :dictField="this.$constants.coreDict.validStatus.key" :disabled="!form.editable"
                              :readonly="!form.editable"
                              autocomplete="off" placeholder=""></dict-option-select>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
import DictOptionSelect from "@/views/system/components/DictOptionSelect";

export default {
  name: "dossierAttachedForm",
  model: {
    prop: 'form',
  },
  props: {
    form: {type: Object},
  },
  components: {DictOptionSelect},
  data() {
    return {
      rules: {
        categoryId: [
          {required: true, message: '门类主键不能为空', trigger: ['blur', 'change']},
          {max: 20, message: '门类主键最大长度为20', trigger: ['blur', 'change']},
        ],
        originalId: [
          {max: 36, message: '文件原文最大长度为36', trigger: ['blur', 'change']},
        ],
        dossierId: [
          {required: true, message: '档案卷宗主键不能为空', trigger: ['blur', 'change']},
          {max: 36, message: '档案卷宗主键最大长度为36', trigger: ['blur', 'change']},
        ],
      }
    }
  },
  methods: {
    /**表单校验回调*/
    async validate(callback) {
      return await this.$refs.attachedForm.validate(callback)
    },
  }
}
</script>

<style lang="scss" scoped>

</style>
